<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>

<form action="<?php echo url_for('compte/update?id='.$sf_user->getGuardUser()->getId()) ?>" method="post" enctype="multipart/form-data" >
  <?php if (!$form->getObject()->isNew()): ?>
  <input type="hidden" name="sf_method" value="put" />
  <?php endif; ?>
  <div class="title_section"> Avatar </div>
  <div align="center" class="section">
    <ul class="InlineBlock" >
      <li> <?php echo $form["photo"]->render(); ?> </li>
    </ul>
  </div>
  <script type="text/javascript">
		tinyMCE.init({
			mode : "exact",
			elements : 'profile_signature',
			realtive_urls:false,
			theme : "advanced",
			   plugins : "autolink,lists,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,searchreplace,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
		
				// Theme options
				theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect,|,sub,sup,|,charmap,cite,abbr,acronym,bullist,numlist|,forecolor,insertimage,|,hr,removeformat",
				theme_advanced_buttons2 : "",
				theme_advanced_buttons3 : "",
		
				// Theme options
			   
				theme_advanced_toolbar_location : "top",
				theme_advanced_toolbar_align : "left",
				theme_advanced_statusbar_location : "bottom",
				theme_advanced_resizing : false,
		
		
		});
		</script>
  <div class="title_section"> Informations générale </div>
  <div align="center" class="section">
    <ul class="InlineBlock" >
      <?php foreach ($form as $row): ?>
      <?php if(!$row->isHidden() && $row != $form["photo"]):?>
      <li class="form_label"> <?php echo $row->renderLabel() ?> </li>
      <li class="form_help"> <?php echo $row->renderHelp() ?> </li>
      <li class="form_error"> <?php echo $row->renderError() ?> </li>
      <li class="form_row"> <?php echo $row->render() ?> </li>
      <?php endif;?>
      <?php endforeach; ?>
    </ul>
  </div>
  <div class="title_section"> Configuration </div>
  <div class="section">
    <?php foreach($groups as $group):?>
    <ul class="elem_on_section">
      <li> <?php echo ucfirst($group["genre"]) ?> <?php echo $group["title_profil_membre"] ?> </li>
      <li class="inline" style="width:5%; text-align:left">
      	<?php if(count($group["Clientsplatforms"]) == 0):?>
        <?php echo image_tag("Icons/".$sf_context->getModuleName()."/121.png", array("width" => 25,"height" => 25, "id" => "img_".$group["idtable2"])) ?>
        <?php elseif($group["Clientsplatforms"][0] == NULL):?>
        <?php echo image_tag("Icons/".$sf_context->getModuleName()."/120.png", array("width" => 25,"height" => 25, "id" => "img_".$group["idtable2"])) ?>
        <?php else:?>
        <?php echo image_tag("Platform/".$group["Clientsplatforms"][0]["Platform"]["picture"], array("width" => 25,"height" => 25, "id" => "img_".$group["idtable2"])) ?>
        <?php endif;?>
      </li>
      <li class="inline" style="width:60%; text-align:left">
        
        <select style="width:90%" name="platform_<?php echo $group["idtable2"] ?>" id="list_<?php echo $group["idtable2"] ?>" onchange="change(<?php echo $group["idtable2"] ?>);">
          <option value="x" lang="121">---- Choisir ----</option>
          <?php foreach($group["Platform"] as $plat):?>
          <?php if($plat["online"] == "1" && $plat["validate"] == "1"):?>
          <option lang="<?php echo $plat["picture"] ?>" value="<?php echo $plat["id"] ?>" <?php if (isset($group["Clientsplatforms"][0]) && $plat["id"] == $group["Clientsplatforms"][0]["Platform"]["id"]):echo " selected ";endif; ?>><?php echo ucfirst($plat["real_name"]) ?></option>
          <?php endif;?>
          <?php endforeach; ?>
          <?php if($group["can_be_excluded"] == "0")?>
          <option lang="120" value="-1" <?php if($group["Clientsplatforms"][0]["Platform"]["id"] == "-1")echo " selected ";?>>Je n'utilise pas de <?php echo $group["title_profil_membre"] ?></option>
        </select>
      </li>
      <li class="inline" style="text-align:left">
      	<?php if(count($group["Clientsplatforms"]) > 0 && $group["Clientsplatforms"][0] != NULL):?>
        <span id="version_<?php echo $group["idtable2"] ?>">
        <select name="version_<?php echo $group["idtable2"] ?>">
          <option value="x">Aucune version</option>
          <?php foreach($group["Clientsplatforms"][0]["Platform"]["Plateformversion"] as $version):?>
          <option value="<?php echo $version["id"] ?>" <?php if ($version["id"] == $group["Clientsplatforms"][0]["Plateformversion"]["id"]):echo " selected ";endif; ?>><?php echo $version["version"] ?></option>
          <?php endforeach;?>
        </select>
        </span>
        <?php else:?>
        <span id="version_<?php echo $group["idtable2"] ?>"></span>
        <?php endif;?>
      </li>
    </ul>
    <?php endforeach;?>
<?php echo $form->renderHiddenFields() ?>
      <div class="form_button">
        <input type="submit" value="Modifier mon profil" />
      </div>
  
  </div>

</form>
